<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateKdQuestionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('kd_questions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('修改者');
            $table->string('question', 2000)->comment('题干');
            $table->string('question_text', 2000)->comment('题干（纯文本）');
            $table->string('category')->comment('1,小白；2,初级；3,中级；4,高级；5,资深；6,大咖；');
            $table->tinyInteger('mandatory')->default(1)->comment('1,非必出题；2,必出题');
            $table->tinyInteger('type')->comment('1，单选题；2，多选题；3，判断题；');
            $table->integer('exam_count')->default(0)->comment('考试量');
            $table->integer('error_count')->default(0)->comment('错误量');
            $table->tinyInteger('score')->default(5)->comment('分数');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE kd_questions COMMENT='题目表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('kd_questions');
    }
}
